<!DOCTYPE html>

<html>

<head>
    <meta charset="utf-8">
    <title>辖区医疗卫生机构统计表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
    <style type="text/css">
        .laytable-cell-radio.layui-table-cell {
            padding: 0 5px 0 15px;
        }
        
        .laytable-cell-radio span {
            display: none;
        }
        
        .laytable-cell-radio .layui-form-radio {
            padding-right: 0;
            margin: 0;
        }
    </style>
</head>

<body>
    <div class="layui-form" style="margin-left:20px;margin-top:15px;margin-bottom:-20px">
        <div class="layui-form-item">
            <label class="layui-form-label">统计日期</label>
            <div class="layui-inline">
                <input type="text" class="layui-input" id="datetime" placeholder="请选择日期">
            </div>
            <button class="layui-btn layui-btn-normal" data-type="reload" id="serch" style="width: 90ox;"><i class="layui-icon">&#xe615;</i>统计</button>
        </div>
    </div>
    <table id="demo" lay-filter="test"></table>
    <script src="../../layuiadmin/layui/layui.js"></script>
    <script src="../../layuiadmin/layui/jquery-3.3.1.min.js"></script>
    <script>
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index']);
        layui.use('laydate', function() {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#datetime', //指定元素
                range: true,
                max: 0,
                theme: '#1E9FFF'
            });
        });
        layui.use('table', function() {
            var table = layui.table;
            var $ = layui.$;

            table.render({
                elem: '#demo',
                height: 'full-80',
                data: [],
                cols: [
                    [ //表头
                        {
                            field: 'type',
                            title: '机构类型',
                            width: "10%"
                        }, {

                            title: '全市',
                            width: "7%",
                            align: 'center',
                            templet: function(d) {
                                return (parseFloat(d.a) + parseFloat(d.b) + parseFloat(d.c) + parseFloat(d.d) + parseFloat(d.e) + parseFloat(d.f) + parseFloat(d.g) + parseFloat(d.h) + parseFloat(d.i) + parseFloat(d.j) + parseFloat(d.k) + parseFloat(d.l) + parseFloat(d.m)).toFixed(2);
                            }
                        }, {
                            field: 'a',
                            title: '上城区',
                            width: "7%",
                            align: "center",
                            templet: function(d) {
                                return d.a.toFixed(2)
                            }

                        }, {
                            field: 'b',
                            title: '下城区',
                            width: "7%",
                            align: "center",
                            templet: function(d) {
                                return d.b.toFixed(2)
                            }

                        }, {
                            field: 'c',
                            title: '江干区',
                            width: "7%",
                            align: "center",
                            templet: function(d) {
                                return d.c.toFixed(2)
                            }

                        }, {
                            field: 'd',
                            title: '拱墅区',
                            width: "6%",
                            align: "center",
                            templet: function(d) {
                                return d.d.toFixed(2)
                            }

                        }, {
                            field: 'e',
                            title: '西湖区',
                            width: "6%",
                            align: "center",
                            templet: function(d) {
                                return d.e.toFixed(2)
                            }

                        }, {
                            field: 'f',
                            title: '滨江区',
                            width: "6%",
                            align: "center",
                            templet: function(d) {
                                return d.f.toFixed(2)
                            }

                        }, {
                            field: 'g',
                            title: '萧山区',
                            width: "6%",
                            align: "center",
                            templet: function(d) {
                                return d.g.toFixed(2)
                            }

                        }, {
                            field: 'h',
                            title: '余杭区',
                            width: "6%",
                            align: "center",
                            templet: function(d) {
                                return d.h.toFixed(2)
                            }

                        }, {
                            field: 'i',
                            title: '桐庐县',
                            width: "6%",
                            align: "center",
                            templet: function(d) {
                                return d.i.toFixed(2)
                            }

                        }, {
                            field: 'j',
                            title: '建德市',
                            width: "6%",
                            align: "center",
                            templet: function(d) {
                                return d.j.toFixed(2)
                            }

                        }, {
                            field: 'k',
                            title: '富阳区',
                            width: "6%",
                            align: "center",
                            templet: function(d) {
                                return d.k.toFixed(2)
                            }

                        }, {
                            field: 'l',
                            title: '临安区',
                            width: "6%",
                            align: "center",
                            templet: function(d) {
                                return d.l.toFixed(2)
                            }

                        }, {
                            field: 'm',
                            title: '淳安县',
                            width: "6%",
                            align: "center",
                            templet: function(d) {
                                return d.m.toFixed(2)
                            }

                        }

                    ]
                ],
                skin: 'row', //表格风格				
                even: true,
            });
            $("#serch").on('click', function() {
                table.reload('demo', {
                    url: '../../../All/health',
                    where: {
                        startdate: $("#datetime").val().split(" - ")[0],
                        enddate: $("#datetime").val().split(" - ")[1],
                    } //设定异步数据接口的额外参数

                });
                $("table tr").css({
                    "background": "#1E9FFF",
                    "color": "white"
                });
            });


            $("table tr").css({
                "background": "#1E9FFF",
                "color": "white"
            });

        });
    </script>
</body>

</html>